package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@TableName("t_post")
public class PostBean {
    @TableId(value = "pk_postId", type = IdType.AUTO)
    private Integer id;

    @TableField("p_theme")
    private String theme;

    @TableField("p_content")
    private String content;

    @TableField(exist = false)
    private UserBean userBean;

    @TableField(exist = false)
    private Integer replyCount;

    @TableField("p_createDate")
    private LocalDate createDate = LocalDate.now();

    @TableField(exist = false)
    private List<ReplyBean> replyList;

    @TableField("fk_userId")
    private Integer userId;

    @TableField("fk_channelId")
    private Integer channelId;

    @TableField(exist = false)
    private ChannelBean channel;

    public PostBean() {
    }

    @Override
    public String toString() {
        return "PostBean{" +
                "id=" + id +
                ", theme='" + theme + '\'' +
                ", content='" + content + '\'' +
                ", userBean=" + userBean +
                ", replyCount=" + replyCount +
                ", createDate=" + createDate +
                ", replyList=" + replyList +
                ", userId=" + userId +
                ", channelId=" + channelId +
                ", channel=" + channel +
                '}';
    }

    public PostBean(String theme, String content, LocalDate createDate, Integer userId, Integer channelId) {
        this.theme = theme;
        this.content = content;
        this.createDate = createDate;
        this.userId = userId;
        this.channelId = channelId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTheme() {
        return theme;
    }

    public void setTheme(String theme) {
        this.theme = theme;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public UserBean getUserBean() {
        return userBean;
    }

    public void setUserBean(UserBean userBean) {
        this.userBean = userBean;
    }

    public Integer getReplyCount() {
        return replyCount;
    }

    public void setReplyCount(Integer replyCount) {
        this.replyCount = replyCount;
    }

    public LocalDate getCreateDate() {
        return createDate;
    }

    public void setCreateDate(LocalDate createDate) {
        this.createDate = createDate;
    }

    public List<ReplyBean> getReplyList() {
        return replyList;
    }

    public void setReplyList(List<ReplyBean> replyList) {
        this.replyList = replyList;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getChannelId() {
        return channelId;
    }

    public void setChannelId(Integer channelId) {
        this.channelId = channelId;
    }

    public ChannelBean getChannel() {
        return channel;
    }

    public void setChannel(ChannelBean channel) {
        this.channel = channel;
    }
}